﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Jumpton.SFA.Server.BusinessRule.MasterData;
using Jumpton.SFA.Server.Entity;
using Jumpton.SFA.Server.BusinessRule;
using Jumpton.SFA.Server.BusinessRule.System;
using Jumpton.SFA.Server.BusinessRule.InStoreDataMeasures;
using Jumpton.Persistent;
using Jumpton.SFA.Entity;

public partial class MESSAGE : PageBase
{
    public String Content;
    public String Title;
    public String CreateTime;
    #region 定义变量

    private int messageID = -1;                  //消息ID号

    #endregion
    protected void Page_Load(object sender, EventArgs e)
    {
        //验证是否通过检查
        if (!IsPostBack)
        {
            int.TryParse(Request.QueryString["id"], out messageID);
            if (messageID > 0)
            {
                var message = new MessageManager().LoadMessage(messageID);
                Fill(message);
                this.DataBind();

            }
            
        }
    }

    protected void Fill(Jumpton.SFA.Server.Entity.Message mes)
    {
        Title = mes.TOPIC;
        //txtStartTime.Text = Jumpton.SFA.Server.BusinessRule.BusinessLogic.GetDateTime(mes.BEGINDATE.ToString(), "yyyyMMdd", "yyyy-MM-dd");

        //txtEndTime.Text = Jumpton.SFA.Server.BusinessRule.BusinessLogic.GetDateTime(mes.ENDDATE.ToString(), "yyyyMMdd", "yyyy-MM-dd");

        //chxActive.Checked = mes.ACTIVE;
        Content = mes.CONTENT;
        //ddlMessageLevel.SelectedValue = mes.CONTENTLEVEL.ToString();
        if (!String.IsNullOrEmpty(mes.PHOTOID))
        {
            image.ImageUrl = "Image.ashx?" + mes.PHOTOID;
        }
        else
        {
            image.Visible = false;
        }
        PHOTO p = null;
        try
        {
            p = new PhotoManager().Load(mes.PHOTOID);
        }
        catch { }

        CreateTime = BusinessLogic.GetDateTime(mes.CREATETIME.ToString());

    }
}